package com.zhang;

import com.zhang.domain.User;
import com.zhang.mapper.UserMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Date;

@SpringBootTest
public class DemoTest1 {

    @Autowired
    private UserMapper userMapper;

    //插入
    @Test
    public void test1() {

        User user = new User();
        user.setUsername("aa");
        user.setPassword("666");
        user.setBirthday(new Date());


        userMapper.insert(user);
        System.out.println(user);
    }



    //更新
    @Test
    public void test2() {

        User user = new User();
        user.setId(10);
        user.setUsername("bb");
        user.setPassword("666");
        user.setBirthday(new Date());


        userMapper.updateById(user);
        System.out.println(user);
    }


}
